package io.github.wanggit.antrpc.demos.circuit_breaker.circuit_breaker_provider.service;

import io.github.wanggit.antrpc.commons.annotations.RpcMethod;
import io.github.wanggit.antrpc.commons.annotations.RpcService;
import io.github.wanggit.antrpc.demos.circuit_breaker.HasDefaultHandlerBreakerService;
import org.apache.commons.lang3.ArrayUtils;

@RpcService
public class HasDefaultHandlerBreakerServiceImpl extends SwitchServiceImpl implements HasDefaultHandlerBreakerService {

    @RpcMethod
    @Override
    public String reverse(String s) {
        if (success){
            char[] chars = s.toCharArray();
            ArrayUtils.reverse(chars);
            return new String(chars);
        }else {
            throw new RuntimeException("Service ERROR.");
        }
    }
}
